#include <Servo.h>

char forward ='w';
char backward='s';
char turnleft = 'a';
char turnright='d';
char STOP='0';

int ml1=4;
int ml2=5;
int mr1=6;
int mr2=7;

char cmd;

void setup(){
  Serial.begin(9600);
  pinMode(ml1,OUTPUT);
  pinMode(ml2,OUTPUT);
  pinMode(mr1,OUTPUT);
  pinMode(mr2,OUTPUT);
}

void loop(){
  if(Serial.available()){
    cmd = Serial.read();
    delay(5);
    Serial.println(cmd);
  }
  if(cmd==forward){
    digitalWrite(ml1,LOW);
    digitalWrite(mr1,LOW);
    digitalWrite(ml2,HIGH);
    digitalWrite(mr2,HIGH);
  }
    if(cmd==backward){
    digitalWrite(ml2,LOW);
    digitalWrite(mr2,LOW);
    digitalWrite(ml1,HIGH);
    digitalWrite(mr1,HIGH);
  }
    if(cmd==turnleft){
    digitalWrite(ml1,LOW);
    digitalWrite(mr1,LOW);
    digitalWrite(ml2,LOW);
    digitalWrite(mr2,HIGH);
  }
    if(cmd==turnright){
    digitalWrite(ml1,LOW);
    digitalWrite(mr1,LOW);
    digitalWrite(ml2,HIGH);
    digitalWrite(mr2,LOW);
  }
    if(cmd==STOP){
    digitalWrite(ml1,LOW);
    digitalWrite(mr1,LOW);
    digitalWrite(ml2,LOW);
    digitalWrite(mr2,LOW);
  }

  
}
